package com.spyx.product;


import com.atyx.spyx.model.product.Category;
import com.atyx.spyx.model.product.SkuInfo;
import com.atyx.spyx.vo.product.SkuInfoVo;
import com.atyx.spyx.vo.product.SkuStockLockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

//使用OpenFeign调取service-product服务
@FeignClient(value = "service-product") //value="项目的名称"
public interface ProductClient {

    //调取service-product中的方法
    @GetMapping("/api/inner/product/getskuinfobyid/{skuid}")
    public SkuInfo findById(@PathVariable("skuid")Long skuid);

    @GetMapping("/api/inner/product/getcategorybyid/{categoryid}")
    public Category getcategorybyid(@PathVariable("categoryid")Long categoryid);

    @PostMapping("/api/inner/product/getskuInfoListbyids")
    public List<SkuInfo> getskuInfoListbyids(@RequestBody List<Long> ids);

    @GetMapping("/api/inner/product/getSkuInfoListBykeyword/{keyword}")
    public List<SkuInfo> getSkuInfoListBykeyword(@PathVariable("keyword")String keyword);

    @PostMapping("/api/inner/product/getcategoryListbyids")
    public List<Category> getcategoryListbyids(@RequestBody List<Long> ids);


    //小程序端的调用
    @GetMapping("/api/inner/product/inner/findAllCategoryList")
    public List<Category> getCategoryList();
    @GetMapping("/api/inner/product/inner/findNewPersonSkuInfoList")
    public List<SkuInfo> getNewPersonSkuinfoList();

    @GetMapping("/api/inner/product/inner/getSkuInfoBySkuId/{skuid}")
    public SkuInfoVo getSkuInfoBySkuId(@PathVariable("skuid")Long skuid);

    @PostMapping("/api/inner/product/inner/checkAndLock/{orderNo}")
    public Boolean checkAndLock(@RequestBody List<SkuStockLockVo> skuStockLockVoList,
                                @PathVariable String orderNo);

}
